package tree;

public class IndexMinPriorityQueue<T extends Comparable<T>> {
    private T[] data;
    private int[] pq;
    private int[] qp;
    private int N;
    public IndexMinPriorityQueue(int capacity){
        data = (T[]) new Comparable[capacity];
        pq = new int[capacity];
        qp = new int[capacity];
    }
    public boolean less(int i ,int j){
        return data[i].compareTo(data[j])<0;
    }
    public void exchange(int i,int j){
        T temp  = data[i];
        data[i] = data[j];
        data[j]=temp;
    }
    public int deMin(){
        T t = data[1];
        return 1;
    }
    public void insert(int i, T t){}
    private void swim(int k){
        while (k>1) {
            if (!less(k,k/2)){
                exchange(k,k/2);
            }
            k=k/2;
        }
    }
    private void sink(int k){
        int temp;
        while (2*k<=this.N){
            if (2*k+1<=this.N){
                temp = less(2*k,2*k+1)?2*k:2*k+1;
            }else {
                temp=2*k;
            }
            if (!less(k,temp)){
                break;
            }
            exchange(k,temp);
            k=temp;
        }
    }
    public int size(){
        return this.N;
    }
    public boolean contains(int k){
        return false;
    }
    public void changeItem(int i ,T t){

    }
    public int minIndex(){
        return -1;
    }
    public void delete(){

    }
}
